<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
  [
    '<div contenteditable>',
      '<div>',
        'before',
        '<table><tbody>',
          '<tr><td>1|</td></tr>',
        '</tbody></table>',
        'after',
      '</div>',
    '</div>',
  ],
  'delete',
  [
    '<div contenteditable>',
      'before',
      '<table><tbody>',
        '<tr><td>|<br></td></tr>',
      '</tbody></table>',
      'after',
    '</div>',
  ],
  '1. Delete the last character in a single-cell table.');

selection_test(
  [
    '<div contenteditable>',
      '<div>',
        'before',
        '<table><tbody>',
          '<tr><td>|1</td></tr>',
        '</tbody></table>',
        'after',
      '</div>',
    '</div>',
  ],
  'ForwardDelete',
  [
    '<div contenteditable>',
      'before',
      '<table><tbody>',
        '<tr><td>|<br></td></tr>',
      '</tbody></table>',
      'after',
    '</div>',
  ],
  '2. forward-delete the last character in a single-cell table.');

selection_test(
  [
    '<div contenteditable>',
      '<div>',
        'before',
        '<table><tbody>',
          '<tr><td>|1^</td></tr>',
        '</tbody></table>',
        'after',
      '</div>',
    '</div>',
  ],
  'delete',
  '<div contenteditable>before<br>|after</div>',
  '3. Select and delete last character in a single-cell table.');

selection_test(
  [
    '<div contenteditable>',
      '<div>',
        'before',
        '<table><tbody>',
          '<tr><td>1|</td><td></td></tr>',
        '</tbody></table>',
        'after',
      '</div>',
    '</div>',
  ],
  'delete',
  [
    '<div contenteditable>',
      'before',
      '<table><tbody>',
        '<tr><td>|<br></td><td></td></tr>',
      '</tbody></table>',
      'after',
    '</div>',
  ],
  '4. Delete the last character in a multiple-cell table.');

selection_test(
  [
    '<div contenteditable>',
      '<div>',
        'before',
        '<table><tbody>',
          '<tr><td>|1^</td><td></td></tr>',
        '</tbody></table>',
        'after',
      '</div>',
    '</div>',
  ],
  'delete',
  [
    '<div contenteditable>',
      'before',
      '<table><tbody>',
        '<tr><td>|<br></td><td></td></tr>',
      '</tbody></table>',
      'after',
    '</div>',
  ],
  '5. Select and delete the last character in a multiple-cell table.');
</script>
